package io.wdb.modules.generator.generator.entity.web;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.util.CollectionUtils;

import com.alibaba.fastjson.JSON;

public class BaseResponse {

	private int result ;
	
	private int code ;
	
	private String message ;
	
	private List items = new ArrayList<>();
	
	private Object detail ;
	
	private int totalcount;
	
	private List pushdata;

	public int getResult() {
		return result;
	}

	public void setResult(int result) {
		this.result = result;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public List getItems() {
		return items;
	}

	public void setItems(List items) {
		this.items = items;
	}

	public Object getDetail() {
		return detail;
	}

	public void setDetail(Object detail) {
		this.detail = detail;
	}

	public int getTotalcount() {
		return totalcount;
	}

	public void setTotalcount(int totalcount) {
		this.totalcount = totalcount;
	}

	public List getPushdata() {
		return pushdata;
	}

	public void setPushdata(List pushdata) {
		this.pushdata = pushdata;
	}

	@Override
	public String toString() {
		Map<String, Object> map = new HashMap<String, Object>();
		if(!CollectionUtils.isEmpty(items)) {
			map.put("items", items);
		}
		if(!CollectionUtils.isEmpty(pushdata)) {
			map.put("pushdata", pushdata);
		}
		if(detail != null) {
			map.put("detail", detail);
		}
		if(totalcount != 0) {
			map.put("totalcount", totalcount);
		}
		return JSON.toJSONString(map);
	}
	
	
}
